<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8.Vue中的样式绑定</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <h1 :style="styleObj" @click="handleClick">hello world</h1> -->
        <h1 :style="[styleObj,{fontSize:'100px'}]" @click="handleClick">hello world</h1>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                styleObj: {
                    color: "black"
                }
            },
            methods: {
                handleClick: function () {
                    this.styleObj.color = this.styleObj.color = "black" ? "red" : "black"
                }
            },
        })
    </script>
</body>

</html>